/*
 * 
 */
package kr.bos.Framework;

import android.util.Log;

/**
 * 로그 쉽게 나오는 클래스
 * @author baek - bispro@uracle.co.kr
 * @date 2011. 12. 29.
 */
public class Logger {
	  public static final int VERBOSE = Log.VERBOSE;
	  public static final int DEBUG = Log.DEBUG;
	  public static final int INFO = Log.INFO;
	  public static final int WARN = Log.WARN;
	  public static final int ERROR = Log.ERROR;
	  public static final int ASSERT = Log.ASSERT;
	
	/** The Constant USE_LOG. */
	public static final boolean USE_LOG = true; 
	public static String TAG = "BOS";
	public static final boolean USE_LIFECYCLE_LOG = false;
	public static final boolean USE_INPUT_LOG = true;

	public static String getTAG() {
		return TAG;
	}

	public static void setTAG(String tag) {
		TAG = tag;
	}
	
	/**
	 * @param str
	 */
	public static void e(String str){
		if(!USE_LOG) return;

		StackTraceElement[] stack = Thread.currentThread().getStackTrace();
		String method	= stack[3].getMethodName();
		String filename	= stack[3].getFileName();
		filename = filename.substring(0, filename.length()-5);

		Log.e(TAG,"["+filename+"]["+method+"]"+str);
	}


	/**
	 * @param str
	 */
	public static void w(String str){
		if(!USE_LOG) return;

		StackTraceElement[] stack = Thread.currentThread().getStackTrace();
		String method	= stack[3].getMethodName();
		String filename	= stack[3].getFileName();
		filename = filename.substring(0, filename.length()-5);

		Log.w(TAG,"["+filename+"]["+method+"]"+str);
	}

	/**
	 * @param str
	 */
	public static void i(String str){
		if(!USE_LOG) return;

		StackTraceElement[] stack = Thread.currentThread().getStackTrace();
		String method	= stack[3].getMethodName();
		String filename	= stack[3].getFileName();
		filename = filename.substring(0, filename.length()-5);

		Log.i(TAG,"["+filename+"]["+method+"]"+str);
	}

	/**
	 * @param str
	 */
	public static void d(String str){
		if(!USE_LOG) return;

		StackTraceElement[] stack = Thread.currentThread().getStackTrace();
		String method	= stack[3].getMethodName();
		String filename	= stack[3].getFileName();
		filename = filename.substring(0, filename.length()-5);

		Log.d(TAG,"["+filename+"]["+method+"]"+str);
	}

	/**
	 * @param str
	 */
	public static void v(String str){
		if(!USE_LOG) return;

		StackTraceElement[] stack = Thread.currentThread().getStackTrace();
		String method	= stack[3].getMethodName();
		String filename	= stack[3].getFileName();
		filename = filename.substring(0, filename.length()-5);

		Log.v(TAG,"["+filename+"]["+method+"]"+str);
	}
}